import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ContractManageVO, ContractManageForm, ContractManageQuery } from '@/api/nursing/contractManage/types';

/**
 * 查询合同列表
 * @param query
 * @returns {*}
 */

export const listContractManage = (query?: ContractManageQuery): AxiosPromise<ContractManageVO[]> => {
  return request({
    url: '/nursing/contractManage/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询合同详细
 * @param contractId
 */
export const getContractManage = (contractId: string | number): AxiosPromise<ContractManageVO> => {
  return request({
    url: '/nursing/contractManage/' + contractId,
    method: 'get'
  });
};

/**
 * 新增合同
 * @param data
 */
export const addContractManage = (data: ContractManageForm) => {
  return request({
    url: '/nursing/contractManage',
    method: 'post',
    data: data
  });
};

/**
 * 修改合同
 * @param data
 */
export const updateContractManage = (data: ContractManageForm) => {
  return request({
    url: '/nursing/contractManage',
    method: 'put',
    data: data
  });
};

/**
 * 删除合同
 * @param contractId
 */
export const delContractManage = (contractId: string | number | Array<string | number>) => {
  return request({
    url: '/nursing/contractManage/' + contractId,
    method: 'delete'
  });
};
